#include "BaseSubsystemPlugin.h"
#include "Log.h"
#include "Expand/PluginsManager.h"
#include "Managers/GameManager.h"
#include "Managers/ComponentsManager.h"

#include "SubsystemBoatBlockBehavior.h"
#include "SubsystemEggBlockBehavior.h"
#include "SubsystemPathfinding.h"
#include "SubsystemCreatureSpawn.h"
#include "SubsystemNoise.h"

#include "SubsystemExplosivesBlockBehavior.h"
#include "SubsystemFurnitureBlockBehavior.h"
#include "SubsystemMagnetBlockBehavior.h"
#include "SubsystemMemoryBankBlockBehavior.h"


#include "Subsystems/SubsystemBodies.h"

#include "Network/PackageManager.h"

#include "ComponentBehaviorSelector.h"
#include "ComponentPilot.h"
#include "ComponentFlyAroundBehavior.h"
#include "ComponentPathfinding.h"
#include "ComponentWalkAroundBehavior.h"
#include "ComponentFlyAwayBehavior.h"
#include "ComponentLookAroundBehavior.h"
#include "ComponentRandomPeckBehavior.h"
#include "ComponentLayEggBehavior.h"
#include "ComponentFishOutOfWaterBehavior.h"
#include "ComponentStareBehavior.h"
#include "ComponentHerdBehavior.h"
#include "ComponentRandomFeedBehavior.h"
#include "ComponentUdder.h"
#include "ComponentShapeshifter.h"
#include "ComponentEatPickableBehavior.h"
#include "ComponentSwimAroundBehavior.h"
#include "ComponentSwimAwayBehavior.h"

#include "SubsystemBodiesBase.h"



#include "GameSingleton.h"

namespace PocketSurvival
{
    BaseSubsystemPlugin::BaseSubsystemPlugin()
    {
        GameSingleton::gameManager->registerSubsystem<SubsystemBoatBlockBehavior>();
        GameSingleton::gameManager->registerSubsystem<SubsystemEggBlockBehavior>();
        GameSingleton::gameManager->registerSubsystem<SubsystemPathfinding>();
        GameSingleton::gameManager->registerSubsystem<SubsystemCreatureSpawn>();
        GameSingleton::gameManager->registerSubsystem<SubsystemNoise>();


        
        GameSingleton::gameManager->registerSubsystem<SubsystemExplosivesBlockBehavior>();
        GameSingleton::gameManager->registerSubsystem<SubsystemFurnitureBlockBehavior>();
        GameSingleton::gameManager->registerSubsystem<SubsystemMagnetBlockBehavior>();
        GameSingleton::gameManager->registerSubsystem<SubsystemMemoryBankBlockBehavior>();
        


        // GameSingleton::gameManager->replaceSubsystem<SubsystemBodies, SubsystemBodiesBase>();

    }

    const std::string &BaseSubsystemPlugin::getPluginName()
    {
        static const std::string pluginName = "原版子系统插件";
        return pluginName;
    }

    const std::string &BaseSubsystemPlugin::getIntroduce()
    {
        static const std::string introduce = "这只是一个原版的子系统测试插件";
        return introduce;
    }

    uint32_t BaseSubsystemPlugin::getUseAuthLevel()
    {
        return 100;
    }

    AuthDisplayType BaseSubsystemPlugin::getDisplayType()
    {
        return AuthDisplayType::Authority;
    }

    void BaseSubsystemPlugin::processCmd(ChatObj &chatObj, std::vector<std::string> &cmdDataVec) {}

    void BaseSubsystemPlugin::load()
    {
        GameSingleton::componentsManager->emplaceComponent<ComponentBehaviorSelector>();
        GameSingleton::componentsManager->emplaceComponent<ComponentPilot>();

        // 鸽子的行为
        GameSingleton::componentsManager->emplaceComponent<ComponentFlyAroundBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentFlyAwayBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentRandomPeckBehavior>();

        GameSingleton::componentsManager->emplaceComponent<ComponentLookAroundBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentPathfinding>();
        GameSingleton::componentsManager->emplaceComponent<ComponentLayEggBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentFishOutOfWaterBehavior>();

        GameSingleton::componentsManager->emplaceComponent<ComponentStareBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentHerdBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentRandomFeedBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentUdder>();
        GameSingleton::componentsManager->emplaceComponent<ComponentShapeshifter>();
        GameSingleton::componentsManager->emplaceComponent<ComponentEatPickableBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentSwimAroundBehavior>();
        GameSingleton::componentsManager->emplaceComponent<ComponentSwimAwayBehavior>();
    }

} // namespace PocketSurvival


using namespace PocketSurvival;

extern "C" void initialize()
{
    GameSingleton::pluginsManager->registerPlugin<BaseSubsystemPlugin>();
    Log::Info("成功加载 BaseSubsystemPlugin 插件");
}
